import { http } from "@/utils/http";

export type commonResult<T> = {
  code: number;
  msg: string;
  result: T;
};

/** 3.3.7 单位选择接口 */
export const getScreenUnitTree = (params?: object) => {
  return http.request<commonResult<any>>("get", '/screen/unity/v2/unity/tree', {
    params
  });
};
/** 3.4.10 组态详情 */
export const getTopoInfo = (params?: object) => {
  return http.request<commonResult<any>>("get", '/screen/statistic/v2/topo-info', {
    params
  });
};
/** 3.4.5建筑信息主页 */
export const getBuildingInfo = (params?: object) => {
  return http.request<commonResult<any>>("get", '/screen/project/v2/building/building', {
    params
  });
};
/** 3.4.6根据图纸id获取图纸信息（包括图纸上的设备点位） */
export const getDrawingInfo = (params?: object) => {
  return http.request<commonResult<any>>("get", '/screen/project/v2/building/drawing', {
    params
  });
};
/** 3.4.11设备列表 */
export const getDeviceList = (params?: object) => {
  return http.request<commonResult<any>>("get", '/screen/project/v2/building/devices', {
    params
  });
};
/** 3.3.1设备概况（单位首页，项目首页，建筑首页，应用系统用着一个） */
export const getDeviceOverview = (params?: object) => {
  return http.request<commonResult<any>>("get", '/screen/unity/v2/device/overview', {
    params
  });
};
/** 3.1.12 告警列表 */
export const getAlarmList = (params?: object) => {
  return http.request<commonResult<any>>("get", '/screen/statistic/v2/alarm/list', {
    params
  });
};
/** 3.1.13 告警处理 */
export const getAlarmHandle = (data?: object) => {
  return http.request<commonResult<any>>("post", '/screen/statistic/v2/alarm/deal', {
    data
  });
};
/** 3.1.14 告警详情 */
export const getAlarmDetail = (params?: object) => {
  return http.request<commonResult<any>>("get", '/screen/statistic/v2/alarm-info', {
    params
  });
};
/** 3.4.7 （项目主页）告警事件-》告警记录(待确认、待处理) */
export const getAlarmRecord = (params?: object) => {
  return http.request<commonResult<any>>("get", '/screen/statistic/v2/project/alarms', {
    params
  });
};
/** 3.4.24 根据项目id查询授权用户（下拉选择框） */
export const getAuthorizeUser = (params?: object) => {
  return http.request<commonResult<any>>("get", '/screen/project/v2/project/authorize-user', {
    params
  });
};
/** 3.1.2.8 流程列表（下拉选择） */
export const getProcessList = (params?: object) => {
  return http.request<commonResult<any>>("get", '/screen/statistic/v2/work-order-processes/select', {
    params
  });
};
/** 3.4.25产品型号下拉框 */
export const getProductType = (params?: object) => {
  return http.request<commonResult<any>>("get", '/screen/project/v2/project/product-ops', {
    params
  });
};
/** 3.4.13根据监控id查询监控信息 */
export const getMonitorInfo = (params?: object) => {
  return http.request<commonResult<any>>("get", '/screen/project/v2/project/monitor', {
    params
  });
};
/** 3.4.12根据设施id查询设施信息 */
export const getFacilityInfo = (params?: object) => {
  return http.request<commonResult<any>>("get", '/screen/project/v2/project/facilit', {
    params
  });
};
/** 3.4.15设备基本信息 */
export const getDeviceInfo = (params?: object) => {
  return http.request<commonResult<any>>("get", '/screen/device/v2/device/device-base', {
    params
  });
};
/** 3.4.14查看设备信息（查看弹出头部信息） */
export const getDeviceBaseInfo = (params?: object) => {
  return http.request<commonResult<any>>("get", '/screen/device/v2/device/device-info', {
    params
  });
};
/** 3.4.19 指令下发 */
export const postCommand = (data?: object) => {
  return http.request<commonResult<any>>("post", '/screen/device/v2/control/command', {
    data
  });
}
/** 3.4.16设备位置 */
export const getDevicePosition = (params?: object) => {
  return http.request<commonResult<any>>("get", '/screen/device/v2/device/position', {
    params
  });
}
/** 3.4.17关联视频 */
export const getDeviceVideo = (params?: object) => {
  return http.request<commonResult<any>>("get", '/screen/device/v2/device/monitor', {
    params
  });
}
/** 3.4.20 查询联动控制列表 */
export const getControlList = (params?: object) => {
  return http.request<commonResult<any>>("get", '/screen/device/v2/control/linkeds', {
    params
  });
}
/** 3.4.21 查询联动控制详情 */
export const getControlDetail = (params?: object) => {
  return http.request<commonResult<any>>("get", '/screen/device/v2/control/linked', {
    params
  });
}
/** 3.4.22 实时数据 */
export const getRealTimeData = (params?: object) => {
  return http.request<commonResult<any>>("get", '/screen/device/v2/data/current', {
    params
  });
}
/** 3.4.23 设备历史数据 */
export const getRealTimeList = (params?: object) => {
  return http.request<commonResult<any>>("get", '/screen/device/v2/data/history', {
    params
  });
}
/** 3.4.18 控制记录列表 */
export const getControlRecord = (params?: object) => {
  return http.request<commonResult<any>>("get", '/screen/device/v2/control/control-records', {
    params
  });
}
/** 3.1.15 设备告警记录列表 */
export const getAlarmRecordList = (params?: object) => {
  return http.request<commonResult<any>>("get", '/screen/statistic/v2/alarm/device', {
    params
  });
}
/** 3.1.16 告警通知记录列表 */
export const getAlarmRecordListOps = (params?: object) => {
  return http.request<commonResult<any>>("get", '/screen/statistic/v2/alarm/notice-records', {
    params
  });
}


/** 3.4.26 设备告警统计 */
export const getdevicealarm = (params?: object) => {
  return http.request<commonResult<any>>("get", 'screen/device/v2/device/alarm', {
    params
  });
}
/** 3.6.2 控制命令配置读取  */
export const commandconfig = (params?: object) => {
  return http.request<commonResult<any>>("get", '/screen/statistic/v2/device/command-config', {
    params
  });
}